package lab03.test01;

import java.io.*;

/**
 * Created by 星月 on 2017/11/16.
 */
public class Test01 {
    public static void main(String[] args) {
        //写文件——字符流
        String  path="F:\\hello.txt";//使用String :字符流
        //字符流写入文件：BufferedWriter,FileWriter()
        BufferedWriter writer=null;
        try {
            writer =new BufferedWriter(new FileWriter(path));//path为路径
            writer.write("hello,word!");//写入内容
            writer.newLine();//换行

            writer.write("101101010101001");
            writer.newLine();

            writer.write("byte!!!!");
        } catch (IOException e) {
            e.printStackTrace();
        }finally {
            try {
                writer.close();//关闭文件
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}
